package com.intco.ait.quotation.api.common.model.request;

import lombok.Data;

@Data
public class PackageSearchVo {

    /**
     * 默认每页条数
     */
    private static final Integer DEFAULT_SIZE = 10;
    /**
     * 默认页
     */
    private static final int DEFAULT_PAGE = 1;
    /**
     * 页码最大不能超过100
     */
    private static final int PAGE_MAX_VALUE = 20;

    /**
     * 当前页码
     */
    private Integer page = DEFAULT_PAGE;
    /**
     * 当前页码
     */
    private Integer pageSize = DEFAULT_SIZE;

    private String name;

    private String status;

    public int getPage() {
        if (page == null) {
            return DEFAULT_PAGE;
        }
        return page;
    }

    public void setPage(Integer page) {
        this.page = Math.min(Math.max(DEFAULT_PAGE, page), PAGE_MAX_VALUE);
    }

    public Integer getPageSize() {
        if (pageSize == null) {
            return DEFAULT_SIZE;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = Math.min(Math.max(DEFAULT_SIZE, pageSize), PAGE_MAX_VALUE);
    }
}
